﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;
using System.Collections.Generic;

public partial class wx_xiaoxi_chakanfasongneirong : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //接收发送消息ID
        string idd = this.Request["id"];
        //判断是否为空
        if (idd != null && idd != "")
        {
            //格式化ID为int类型
            int id = Int32.Parse(idd);
            //设置WHERE语句
            string where = "m_id='{0}'";
            where = string.Format(where, id);
            //查询数据库
            IList<message> list = messageBLL.Select(where);
            //判断是否为空
            if (list.Count != 0)
            {
                //用实体接收显示
                message m = list[0];
                this.txt_biaoti.Text = m.m_title;
                this.txt_neirong.Text = m.m_content;
                //把发送人ID转换成中文名字
                users uu = usersBLL.Select(m.m_u_id);
                this.txt_fabiaoren.Text = uu.u_username;

            }
                //如果为空，显示数据库中无此数据
            else
            {
                this.Response.Write(string.Format(GetRedirect.WINALERT, "数据库中无此数据"));
            }
        }
            //如果接收的发送消息ID为空，跳回发送记录页
        else
        {
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "fasongjilu.aspx"));
        }

    }
}
